 {block name="body"}
<link href="__CSS__/bootstrap.min.css" rel="stylesheet">
<link href="__CSS__/font-awesome.min.css" rel="stylesheet">
<link href="__CSS__/animate.min.css" rel="stylesheet">
<link href="__CSS__/style.min.css" rel="stylesheet">
<link href="__CSS__/admin.css" rel="stylesheet">
{block name="style"}<link href="__LIB__/fileinput/css/fileinput.min.css" rel="stylesheet" /> {/block}
<div class="ibox float-e-margins">
	<div class="ibox-content form-horizontal">
		<!--商品栏目设置-->
		<div class="form-group">
			<label class="col-sm-3 control-label">店铺当前积分余额：</label>
			<div class="input-group col-sm-4">
				<label class="col-sm-3 control-label" style="margin-left: -10px;text-align: left;">{$score}</label>
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label">交友团栏目商品名称：</label>
			<div class="input-group col-sm-4">
				<input type="text" id="jyt_name" name="jyt_name" value="{$jytgood.jyt_name}" class="form-control" />
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label">参团人数：</label>
			<div class="input-group col-sm-4">
				<input type="text" id="jytneed_person" name="jytneed_person" value="{$jytgood.jytneed_person}" class="form-control" />
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label">开团数：</label>
			<div class="input-group col-sm-4">
				<input type="text" id="jyt_kts" name="jyt_kts" value="{$jytgood.jyt_kts}" class="form-control" />
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label">群二维码图片：</label>
			<div class="input-group col-sm-4">
				<input type="hidden" id="jyt_code" name="jyt_code" value="{$jytgood.jyt_code}"/>
				<input id="upload" name="upload" type="file" />
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label">购买商品该需要现金：</label>
			<div class="input-group col-sm-4">
				<input type="text" id="jytneed_money" name="jytneed_money" value="{$jytgood.jytneed_money}" class="form-control" onkeyup="this.value=this.value.replace(/[^\d]/g,'') " onafterpaste="this.value=this.value.replace(/[^\d]/g,'') "/>
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label">上架数量：</label>
			<div class="input-group col-sm-4">
				<input type="text" id="jyt_num" name="jyt_num" value="{$jytgood.jyt_num}" class="form-control" onkeyup="this.value=this.value.replace(/[^\d]/g,'') " onafterpaste="this.value=this.value.replace(/[^\d]/g,'') "/>
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label">状态：</label>
			<div class="input-group col-sm-4" id="jyt_status">
			<input type="radio" name="is_jyt" id="is_jyt" value="0" {if $jytgood.is_jyt==0} {php echo checked="true"} {/if}/> 关闭
			&nbsp;
			<input type="radio" name="is_jyt" id="is_jyt" value="1" {if $jytgood.is_jyt==1} {php echo checked="true"} {/if}/> 开启
			</div>
		</div>
		<!--商品栏目设置end-->
		
		
		<div class="form-group">
			<div class="col-sm-4 col-sm-offset-8" style="text-align: right;">
				<button class="btn btn-info"><i class="fa fa-save"></i> 保存</button>&nbsp;&nbsp;
				<span onclick="wclose()"><a class="btn btn-danger"><i class="fa fa-arrow-left"></i> 返回 </a></span>
			</div>
		</div>
	</div>
</div>
{/block} {block name="script"}
<script src="__JS__/jquery.min.js"></script>
<script src="__JS__/bootstrap.min.js"></script>
<script src="__JS__/jquery.metisMenu.js"></script>
<script src="__JS__/jquery.slimscroll.min.js"></script>
<script src="__LIB__/layer/layer.js"></script>
<script src="__LIB__/validate/jquery.validate.min.js"></script>
<script src="__LIB__/validate/messages_zh.min.js"></script>
<script src="__LIB__/validate/add_validate.min.js"></script>
<script src="__LIB__/fileinput/js/fileinput.min.js"></script>
<script src="__LIB__/fileinput/js/locales/zh.js"></script>
<script src="__LIB__/ueditor/ueditor.config.js" type="text/javascript"></script>
<script src="__LIB__/ueditor/ueditor.all.js" type="text/javascript"></script>
<script>
	

	function wclose(){
    	var index = parent.layer.getFrameIndex(window.name); //获取窗口索引  
        parent.layer.close(index);  
	}
	
	$(".btn-info").click(function(){
    	var id = '{$id}';
    	var score = '{$score}';
    	var jytgive_score = $("#jytgive_score").val();
    	var jyt_num = $("#jyt_num").val();
    	var jytneed_person = $("#jytneed_person").val();
    	var jyt_name = $("#jyt_name").val();
    	if(!jyt_name){	    	
    		layer.msg("请输入商品名称");
    		return;
    	}  	
    	if(!jytneed_person||jytneed_person==0){	    	
    		layer.msg("请输入参团人数");
    		return;
    	}
    	if(!jyt_num||jyt_num==0){	    	
    		layer.msg("请输入上架数量");
    		return;
    	}
    	if(jyt_num!=jytneed_person){	    	
    		layer.msg("参团人数必须与上架数量一致");
    		return;
    	}
		
    	$.ajax({
            type:"POST",
            url:"savept",
			data:{id:id,jyt_name:$("#jyt_name").val(),jytneed_person:$("#jytneed_person").val(),jytneed_money:$("#jytneed_money").val(),is_jyt:$('#jyt_status input[name="is_jyt"]:checked').val(),jyt_num:$("#jyt_num").val(),jyt_kts:$("#jyt_kts").val(),jyt_code:$("#jyt_code").val()},
            success:function(data){
				layer.msg(data.msg, {
				  icon: 1,
				  time: 1000 //2秒关闭（如果不配置，默认是3秒）
				}, function(){
					if(data.code == 200) {
						parent.layer.closeAll();
   						parent.window.location.reload();
   					}
				}); 
            }
		});		
    });
</script>
{/block}